+2006-07-20 Matthias Clasen <mclasen@redhat.com>
+
+ * xdgmimemagic.c:
+ * xdgmime.c:
+ * xdgmime.h: Add xdg_init-free versions of some
+ functions and use them internally, so that we don't
+ reload caches and clobber data structures in the
+ middle of an operation. Patch by Joe Shaw,
+ bugs.freedesktop.org #6824
+
2006-07-19 Matthias Clasen <mclasen@redhat.com>
* xdgmimeglob.c (_xdg_glob_hash_node_lookup_file_name):
}
const char *
-xdg_mime_unalias_mime_type (const char *mime_type)
+_xdg_mime_unalias_mime_type (const char *mime_type)
{
const char *lookup;
- xdg_mime_init ();
-
if (_caches)
return _xdg_mime_cache_unalias_mime_type (mime_type);
return mime_type;
}
+const char *
+xdg_mime_unalias_mime_type (const char *mime_type)
+{
+ xdg_mime_init ();
+
+ return _xdg_mime_unalias_mime_type (mime_type);
+}
+
int
-xdg_mime_mime_type_equal (const char *mime_a,
- const char *mime_b)
+_xdg_mime_mime_type_equal (const char *mime_a,
+ const char *mime_b)
{
const char *unalias_a, *unalias_b;
- xdg_mime_init ();
-
- unalias_a = xdg_mime_unalias_mime_type (mime_a);
- unalias_b = xdg_mime_unalias_mime_type (mime_b);
+ unalias_a = _xdg_mime_unalias_mime_type (mime_a);
+ unalias_b = _xdg_mime_unalias_mime_type (mime_b);
if (strcmp (unalias_a, unalias_b) == 0)
return 1;
return 0;
}
+int
+xdg_mime_mime_type_equal (const char *mime_a,
+ const char *mime_b)
+{
+ xdg_mime_init ();
+
+ return _xdg_mime_mime_type_equal (mime_a, mime_b);
+}
+
int
xdg_mime_media_type_equal (const char *mime_a,
const char *mime_b)
#endif
int
-xdg_mime_mime_type_subclass (const char *mime,
- const char *base)
+_xdg_mime_mime_type_subclass (const char *mime,
+ const char *base)
{
const char *umime, *ubase;
const char **parents;
- xdg_mime_init ();
-
if (_caches)
return _xdg_mime_cache_mime_type_subclass (mime, base);
- umime = xdg_mime_unalias_mime_type (mime);
- ubase = xdg_mime_unalias_mime_type (base);
+ umime = _xdg_mime_unalias_mime_type (mime);
+ ubase = _xdg_mime_unalias_mime_type (base);
if (strcmp (umime, ubase) == 0)
return 1;
parents = _xdg_mime_parent_list_lookup (parent_list, umime);
for (; parents && *parents; parents++)
{
- if (xdg_mime_mime_type_subclass (*parents, ubase))
+ if (_xdg_mime_mime_type_subclass (*parents, ubase))
return 1;
}
return 0;
}
+int
+xdg_mime_mime_type_subclass (const char *mime,
+ const char *base)
+{
+ xdg_mime_init ();
+
+ return _xdg_mime_mime_type_subclass (mime, base);
+}
+
char **
xdg_mime_list_mime_parents (const char *mime)
{
xdg_mime_init ();
- umime = xdg_mime_unalias_mime_type (mime);
+ umime = _xdg_mime_unalias_mime_type (mime);
return _xdg_mime_parent_list_lookup (parent_list, umime);
}
{
if (_xdg_mime_magic_match_compare_to_data (match, data, len))
{
- if ((mime_type == NULL) || (xdg_mime_mime_type_subclass (match->mime_type, mime_type))) {
+ if ((mime_type == NULL) || (_xdg_mime_mime_type_subclass (match->mime_type, mime_type))) {
mime_type = match->mime_type;
}
}
for (n = 0; n < n_mime_types; n++)
{
if (mime_types[n] &&
- xdg_mime_mime_type_equal (mime_types[n], match->mime_type))
+ _xdg_mime_mime_type_equal (mime_types[n], match->mime_type))
mime_types[n] = NULL;
}
}